<script setup lang="tsx">
import { message } from "@/utils/message";
import { type PlusColumn, PlusDescriptions } from "plus-pro-components";
import { ref, nextTick, computed, onMounted } from "vue";
const prop: any = defineProps({
  info: {
    default: () => {}
  }
});

</script>

<template>
  <div>

    <el-descriptions :column="1" border>
      <el-descriptions-item label="项目名称">{{prop.info?.project?.projectName || '--'}}</el-descriptions-item>
      <el-descriptions-item label="项目编码">{{prop.info?.project?.projectNo || '--'}}</el-descriptions-item>
      <el-descriptions-item label="任务阶段">{{prop.info?.taskTypeName || '--'}}</el-descriptions-item>
      <el-descriptions-item label="任务人数">
        {{prop.info?.hasMultiUser === 0?'单人任务':'多人任务'}}
      </el-descriptions-item>
      <el-descriptions-item label="指派给用户">

        <div class="assigneds">
          <span v-for="(item, curr) in prop.info?.assigneds" :key="curr" class="str">
            {{item.user?.name}}<span>, </span>
          </span>
        </div>
      </el-descriptions-item>
      <el-descriptions-item label="实际日期">
        {{ prop.info?.realStartDate??'--' }} 至 {{prop.info?.realEndDate??'--'}}
      </el-descriptions-item>
      <el-descriptions-item label="计划日期">
        {{ prop.info?.planStartDate??'--' }} 至 {{prop.info?.planEndDate??'--'}}
      </el-descriptions-item>
      <el-descriptions-item label="预计小时">{{parseInt(prop.info?.expectHour*8)}}</el-descriptions-item>
      <el-descriptions-item label="状态">
        <el-tag type="info" v-if="prop.info?.status === 0">未开始</el-tag>
        <el-tag type="warning" v-if="prop.info?.status === 1">进行中</el-tag>
        <el-tag v-if="prop.info?.status === 2">挂起跳过</el-tag>
        <el-tag type="success" v-if="prop.info?.status === 3">已完成</el-tag>
        <el-tag type="danger" v-if="prop.info?.status === 4">已关闭</el-tag>
      </el-descriptions-item>
      <el-descriptions-item label="完成比例(%)">{{prop.info?.completeRate || '--'}}</el-descriptions-item>
      <el-descriptions-item label="收款比例(%)" v-if="prop.info?.taskType === 1020000 || prop.info?.taskType === 1070000 || prop.info?.taskType === 1090000
      || prop.info?.taskType === 1120000">
        {{prop.info?.receiptRatio || '--'}}
      </el-descriptions-item>
      <el-descriptions-item label="描述">{{prop.info?.description || '--'}}</el-descriptions-item>
      <el-descriptions-item label="关键词">{{prop.info?.keyword || '--'}}</el-descriptions-item>
      <el-descriptions-item label="优先级">{{prop.info?.priority || '--'}}</el-descriptions-item>
      <el-descriptions-item label="抄送给用户">
        <div class="assigneds">
          <span v-for="(item, curr) in prop.info?.assignedExtras" :key="curr" class="str">
            {{item.user?.name}}<span>, </span>
          </span>
          <span v-if="prop.info?.assignedExtras && prop.info?.assignedExtras.length ===0">--</span>
        </div>
      </el-descriptions-item>
    </el-descriptions>
  </div>
</template>
<style scoped lang="scss">
  .assigneds {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .assigneds .str:last-child span{
    display: none;
  }
</style>
